<%@ page language="java" contentType="text/html; charset=UTF-8"	 pageEncoding="UTF-8"%>
<%@ include file="../include/laypublic.jsp"%>
<!DOCTYPE html>
<html>
<head>
  <title>总分包及设备合同</title>
  <style type="text/css">
  </style>
</head>
<body>
  <div class="layui-fluid">   
    <div class="layui-card">
      <!-- 查询区域  -->
      <div id="query-form" class="layui-form layui-card-header layuiadmin-card-header-auto">
        <div class="layui-form-item">
          	<div class="layui-inline">
            	<label class="layui-form-label">公司主体</label>
            	<div class="layui-input-inline" style="width:260px;">
              		<select name="orgTypeAndId" id="query_select_orgId" lay-filter="query_select_orgId" lay-search >
	              		<c:if test="${not empty orgInfos }">
	              			<c:forEach items="${orgInfos}" var="org">
	              				<option value="${org.id}-${org.types}" <c:if test="${org.id == bindOrgId }">selected</c:if>>${org.compName }</option>
		            		</c:forEach>
	              		</c:if>
	              	</select>
            	</div>
          	</div>
          	<div class="layui-inline">
            	<label class="layui-form-label">项目名称</label>
            	<div class="layui-input-inline">
              		<input type="text" name="proName" id="query_input_proName" class="layui-input"  placeholder="请输入" autocomplete="off">
            	</div>
          	</div>
          	<div class="layui-inline">
            	<label class="layui-form-label">合同类别</label>
            	<div class="layui-input-inline">
              		<select name="extType" id="query_select_extType">
           				<option value>请选择-合同类型</option>
           				<option value="11">内部协议</option>
           				<option value="12">内部协议补充合同</option>
           				<option value="21">分包合同</option>
           				<option value="22">分包合同补充合同</option>
           				<option value="31">设备合同</option>
           				<option value="32">设备合同补充合同</option>
	              	</select>
            	</div>
          	</div>
          	<div class="layui-inline">
            	<label class="layui-form-label">合同名称</label>
            	<div class="layui-input-inline">
              		<input type="text" name="contractName" id="query_input_contractName" class="layui-input"  placeholder="请输入" autocomplete="off">
            	</div>
          	</div>
          	<shiro:hasPermission name="LIST_BPAST_PACKDEVICE">
	          <div class="layui-inline">
	            <button class="layui-btn layuiadmin-btn-admin" lay-submit lay-filter="LAY-bpastPackDevice-search">
	              <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>查询
	            </button>
	          </div>
          	</shiro:hasPermission>
        </div>
      </div>
      <div class="layui-card-body">
        <table id="LAY-bpastPackDevice-manage" lay-filter="LAY-bpastPackDevice-manage"></table>
      </div>
    </div>
  </div>

  <script>
  	layui.config({
    	base: '${ctx}/resources/layuiadmin/' //静态资源所在路径
  	}).extend({
    	index: 'lib/index' //主入口模块
  	}).use(['index', 'table', 'set', 'laydate', 'element'], function(){
    	var $ = layui.$
    	,form = layui.form
    	,table = layui.table
    	,laydate = layui.laydate
    	,element = layui.element;
	    
		form.on('select(query_select_orgId)', function(data){
   		 	table.reload('LAY-bpastPackDevice-manage', {page: {curr: 1},
		 		where: {'extType':$('#query_select_extType').val(),'contractName':$('#query_input_proName').val(),'orgTypeAndId':$('#query_select_orgId').val(),'proName':$('#query_input_proName').val()}
	      	});
    	});
		
    	// 表单
    	table.render({
      		elem: '#LAY-bpastPackDevice-manage'
      		,url: basePath + '/bpastPackDevice/queryDataByCondition' //请求数据接口
      		,where: {'extType':$('#query_select_extType').val(),'contractName':$('#query_input_proName').val(),'orgTypeAndId':$('#query_select_orgId').val(),'proName':$('#query_input_proName').val()}
      		,cols: [[
				{type:'numbers', title: '序号',fixed:'left', width: 80, align:'center'}
				,{field: 'proName', title: '项目名称',fixed:'left',width: 180, align:'center'}
				,{field: 'orgAreaName', title: '区域公司',fixed:'left',width: 180, align:'center'}
				,{field: 'extType', title: '合同类别',width: 150, align:'center', templet: function(d){
						if(d.extType == '11'){
							return '内部协议';
						}else if(d.extType == '12'){
							return '内部协议补充合同';
						}else if(d.extType == '21'){
							return '分包合同';
						}else if(d.extType == '22'){
							return '分包合同补充合同';
						}else if(d.extType == '31'){
							return '设备合同';
						}else if(d.extType == '32'){
							return '设备合同补充合同';
						}
				}}
				,{field: 'contractName', title: '合同名称',width: 180, align:'center'}
				,{field: 'endTime', title: '审核通过时间', width: 170,align:'center', templet: function(d){
						if(d.endTime != ''){
        		  			return layui.util.toDateString(d.endTime,"yyyy-MM-dd HH:mm:ss");
						}else{
							global_null_tip;
						}
              		}
             	}
				,{field: 'contractNo', title: '合同编码',width: 150, align:'center', templet: function(d){
	    				return d.contractNo||global_null_tip;
	          		}
				}
				,{field: 'sgCoopName', title: '合同单位名称',width: 180, align:'center'}
				,{field: 'signDate', title: '合同签订日期', width: 150,align:'center', templet: function(d){
						if(d.signDate != ''){
        		  			return layui.util.toDateString(d.signDate,"yyyy-MM-dd");
						}else{
							global_null_tip;
						}
              		}
             	}
				,{field: 'afterTotalSum', title: '合同总价（元）（下浮后）',width: 150, align:'center', templet: function(d){
					    return formatCurrency(d.afterTotalSum);
				}}
				,{field: 'totalRate', title: '建安下浮率（%）',width: 150, align:'center', templet: function(d){
    					return d.totalRate||global_null_tip;
          			}
				}
				,{field: 'beginBuildDate', title: '合同开工日期', width: 150 ,align:'center', templet: function(d){
						if(d.beginBuildDate != ''){
	    		  			return layui.util.toDateString(d.beginBuildDate,"yyyy-MM-dd");
						}else{
							global_null_tip;
						}
	          		}
	         	}
				,{field: 'endBuildDate', title: '合同竣工日期', width: 150 ,align:'center', templet: function(d){
						if(d.endBuildDate != ''){
	    		  			return layui.util.toDateString(d.endBuildDate,"yyyy-MM-dd");
						}else{
							global_null_tip;
						}
	          		}
	         	}
				,{field: 'saMemo', title: '补充协议内容说明',width: 190, align:'center', templet: function(d){
	    				return d.saMemo||global_null_tip;
	          		}
	    		}       		
				]]
      		,page: true
      		,limit: 10
    	});
    
    	<shiro:hasPermission name="LIST_BPAST_PACKDEVICE">
	    	//监听搜索
	    	form.on('submit(LAY-bpastPackDevice-search)', function(data){
		      	//执行重载
		      	table.reload('LAY-bpastPackDevice-manage', {page: {curr: 1},
		        	where: trimData(data)
		      	});
	    	});
    	</shiro:hasPermission>
  });
  	
  </script>
</body>
</html>

